package com.tfswx.jkgl.designer.api;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.tfswx.jkgl.designer.dto.xmgl.*;
import com.tfswx.jkgl.designer.service.XmglService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ricky
 * @date 2021/12/10
 */
@Api(tags = "项目管理")
@RestController
@RequestMapping("api")
@ApiSupport(order = 10)
public class XmglController {

    @Resource
    private XmglService xmglService;

    @ApiOperation("添加项目信息")
    @PostMapping("/addXmxx")
    @ApiOperationSupport(order = 10)
    public String addXmxx(@RequestBody @Validated XmxxAddInputDTO inputDTO) {
        return xmglService.addXmxx(inputDTO);
    }

    @ApiOperation("删除项目信息")
    @PostMapping("/deleteXmxx")
    @ApiOperationSupport(order = 20)
    public Boolean deleteXmxx(@RequestBody @Validated XmxxDeleteInputDTO inputDTO) {
        return xmglService.deleteXmxx(inputDTO);
    }

    @ApiOperation("修改项目信息")
    @PostMapping("/updateXmxx")
    @ApiOperationSupport(order = 30)
    public Boolean updateXmxx(@RequestBody @Validated XmxxUpdateInputDTO inputDTO) {
        return xmglService.updateXmxx(inputDTO);
    }

    @ApiOperation("查询项目信息")
    @PostMapping("/queryXmxx")
    @ApiOperationSupport(order = 40)
    public List<XmxxQueryOutputDTO> queryXmxx(@RequestBody @Validated XmxxQueryInputDTO inputDTO) {
        return xmglService.queryXmxx(inputDTO);
    }

    @ApiOperation("添加模块信息")
    @PostMapping("/addMkxx")
    @ApiOperationSupport(order = 50)
    public String addMkxx(@RequestBody @Validated MkxxAddInputDTO inputDTO) {
        return xmglService.addMkxx(inputDTO);
    }

    @ApiOperation("删除模块信息")
    @PostMapping("/deleteMkxx")
    @ApiOperationSupport(order = 60)
    public Boolean deleteMkxx(@RequestBody @Validated MkxxDeleteInputDTO inputDTO) {
        return xmglService.deleteMkxx(inputDTO);
    }

    @ApiOperation("修改模块信息")
    @PostMapping("/updateMkxx")
    @ApiOperationSupport(order = 70)
    public Boolean updateMkxx(@RequestBody @Validated MkxxUpdateInputDTO inputDTO) {
        return xmglService.updateMkxx(inputDTO);
    }

    @ApiOperation("查询模块信息")
    @PostMapping("/queryMkxx")
    @ApiOperationSupport(order = 80)
    public List<MkxxQueryResult> queryMkxx(@RequestBody @Validated MkxxQueryInputDTO inputDTO) {
        return xmglService.queryMkxx(inputDTO);
    }

    @ApiOperation("查询子模块和实体列表")
    @PostMapping("/queryZmkhstlb")
    @ApiOperationSupport(order = 80)
    public List<ZmkhstlbQueryResult> queryZmkhstlb(@RequestBody @Validated ZmkhstlbQueryInputDTO inputDTO) {
        return xmglService.queryZmkhstlb(inputDTO);
    }

    @ApiOperation("复制项目")
    @PostMapping("/copyXm")
    @ApiOperationSupport(order = 90)
    public Boolean copyXm(@RequestBody @Validated XmCopyInputDTO inputDTO) {
        return xmglService.copyXm(inputDTO);
    }
}
